import Cookies from 'js-cookie'

const TokenKey = 'qxh_token'

// 专门用来记录token开始时间的
const TimeKey = 'qxh_time'

const TenantIdKey = 'qxh_ID'

export function getToken () {
  return Cookies.get(TokenKey)
}

export function setToken (token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken () {
  return Cookies.remove(TokenKey)
}

// 获取token开始的时间
export function getTokenTime () {
  return Cookies.get(TimeKey)
}

// 设置token开始的时间
export function setTokenTime () {
  return Cookies.set(TimeKey, Date.now())
}

// 删除token开始的时间
export function removeTokenTime () {
  return Cookies.remove(TimeKey)
}

// 获取用户id
export function getTenantId () {
  return Cookies.get(TenantIdKey)
}

export function setTenantId (username) {
  return Cookies.set(TenantIdKey, username)
}

export function removeTenantId () {
  return Cookies.remove(TenantIdKey)
}
